package com.rzjm.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rzjm.api.dao.DepartmentDao;
import com.rzjm.api.entity.Department;
import com.rzjm.api.service.DepartmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 方法说明： 实现层
 * @author Mr.Zhou
 * @date 2020/3/17
 */
@Service
public class DepartmentServiceImpl extends BaseServiceImpl<DepartmentDao, Department> implements DepartmentService {

    @Resource
    private DepartmentDao departmentDao;

    @Override
    public Department getSafeDepart(int companyId) {
        QueryWrapper<Department> qw = new QueryWrapper<>();
        qw.eq("company_id",companyId);
        qw.eq("dept_type",1);
        qw.last("limit 1");
        Department department = departmentDao.selectOne(qw);
        return department;
    }
}
